package com.gaswell.common.exception;

import com.gaswell.vo.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;
//捕获全局异常
@ControllerAdvice
public class XWExceptionHandler {
    @ExceptionHandler(value = RRException.class)
    @ResponseBody
    public Map ningError(RRException e){
        e.printStackTrace();
        Map<String , Object> map = new HashMap<>();
        map.put("code",e.getCode());
        map.put("massage",e.getMsg());
        return map;
    }
}
